<?php

class m130807_161148_create_table_users extends CDbMigration
{
	public function up()
	{
		$this->createTable('{{users}}',array(
			'id'=>'pk',
			'login'=>'VARCHAR(100) NOT NULL',
			'email'=>'VARCHAR(100) NULL DEFAULT NULL',
			'password'=>'VARCHAR(100) NOT NULL',
			'role'=>'INT(1) NOT NULL',
			'organization_id'=>'INT(11) NOT NULL',
			'shop_id'=>'INT(11) NULL DEFAULT NULL',
			'created_at'=>'DATETIME NOT NULL',
			'updated_at'=>'TIMESTAMP',
			'active'=>'INT(1) NOT NULL DEFAULT 1'
		));

		$this->insert('{{users}}',array(
			'login'=>'admin',
			'email'=>'admin@mail.com',
			'password'=>'cc063d73d31b8243e3369351b82ebd2c',
			'role'=>'1',
			'organization_id'=>'0',
			'created_at'=>date('Y-m-d H:i:s')
		));
	}

	public function down()
	{
		$this->dropTable('{{users}}');
	}

	/*
	// Use safeUp/safeDown to do migration with transaction
	public function safeUp()
	{
	}

	public function safeDown()
	{
	}
	*/
}